﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using log4net;

namespace FSLog
{
    /// <summary>
    /// 全局日志文件
    /// 封装了Log4net对象
    /// 需要引用log4net.dll文件
    /// </summary>
    public class Log4Net
    {
        private static Log4Net singleton;
        /// <summary>
        /// 获取日志单例对象
        /// </summary>
        public static Log4Net Singleton
        {
            get
            {
                if (singleton == null)
                {
                    singleton = new Log4Net();
                }

                return singleton;
            }
        }

        private Log4Net()
        {
            log4net.Config.XmlConfigurator.Configure(new FileInfo("logconfig.xml"));
            this.logObj = LogManager.GetLogger("LogFileAppender");            
        }

        private ILog logObj;
        /// <summary>
        /// 获取日志对象
        /// </summary>
        public ILog LogObj
        {
            get
            {
                return logObj;
            }
        }
    }
}
